import React from 'react';
import { AppRouter } from './routes';
import { ConfigProvider, theme, App as AntApp } from 'antd';
import { setModal } from './utils/antd-static';

const AppContent: React.FC = () => {
  const staticFunctions = AntApp.useApp();
  // Assign the modal instance to our exported variable.
  setModal(staticFunctions.modal);
  return <AppRouter />;
}

function App() {
  return (
    <ConfigProvider
      theme={{
        algorithm: theme.darkAlgorithm,
      }}
    >
      <AntApp>
        <AppContent />
      </AntApp>
    </ConfigProvider>
  );
}

export default App;
